// 1. test $()
function test$(){
	var d = $('myDiv');
	alert(d.innerHTML);
	d.hide();
	d.show();
	d.addClassName('active');
}

// 2. test $$()
function test$$(){
	/*
	  in case CSS is not your forte, the expression below says
	  'find all the INPUT elements that are inside 
	  elements with class=field that are inside a DIV
	  with id equal to loginForm.'
	*/
	var f = $$('div#loginForm .field input');
	var s = '';
	for(var i=0; i<f.length; i++){
		s += f[i].value + '/';
	}
	alert(s); // shows: "joedoe1/secret/"
	
	//now passing more than one expression
	f = $$('div#loginForm .field input', 'div#loginForm .fieldName');
	s = '';
	for(var i=0; i<f.length; i++){
		s += ( f[i].value ? f[i].value : f[i].innerHTML ) + '/';
	}
	alert(s); //shows: "joedoe1/secret/User name:/Password:/"
}

// 3. test $F()
function test$F()
{
	alert(  $F('userName')  );
}

// 4. test $A()
function showOptions(){
	var someNodeList = $('lstEmployees').getElementsByTagName('option');
	var nodes = $A(someNodeList);
	nodes.each(function(node){
		alert(node.nodeName + ': ' + node.innerHTML);
	});
}
	
// 5. test $H()
function testHash()
{
	//let's create the object
	var a = {
		first: 10,
		second: 20,
		third: 30
		};

	//now transform it into a hash
	var h = $H(a);
	alert(h.toQueryString()); //displays: first=10&second=20&third=30
}

// 6. test $R()
function demoDollar_R(){
	var range = $R(10, 20, false);
	range.each(function(value, index){
		alert(value);
	});
}

// 7. test $w()
function demoDollar_w(){
	$w('apples bananas kiwis').each(function(fruit){
	  var message = 'I like ' + fruit;
	  alert(message);
	  // do something with the message
	})
}
